package org.smile.design.proxy.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class DeliveryClerk implements InvocationHandler {
    private Object target;

    public DeliveryClerk(Object customer){
        this.target = customer;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println(proxy.getClass().getName());
        System.out.println(this.getClass().getSimpleName()+" take food from store");
        Object object = method.invoke(target, args);
        System.out.println(this.getClass().getSimpleName()+" finish job");
        return object;
    }
}
